/* 网站首页懒加载页面所使用的js
 * @author 王校兵
 * @date 2016-7-20
 * @version 1.0
 */

//首页下拉时触发的时间
function indexScrollDownJs(scrollLength){
	
	if (scrollLength > 1400 && scrollLength < 2000 && !index_floor_state[0]) {
		//创建右侧标题数组
		var rightTitle = [ [ "#", "书画摄影" ], [ "#", "篆刻雕塑" ], [ "#", "摄影摄像" ], ["","》"]];
		$.post("indexProduct", {
			page : "001",
			fromPosition : "0010401",
			toPosition : "0010412",
			newsToPosition : "0010409"
		}, function(data, status) {
			var product = data.pictureAndProduct;
			
			//拼接商品区域的html
			var goods_html = combineGoodsOne("书画摄影", rightTitle, product, "论坛/", data.news);
			$("#index_shuhua").html(goods_html);
			
			//拼接广告区域
			var ad_html = combineBottomAdOne(product[9], product[10], product[11]);
			$("#index_shuhua_ad").html(ad_html);
			
		}, "json");
		
		index_floor_state[0] = true;
	}else if(scrollLength > 2000 && scrollLength < 2600 && !index_floor_state[1]){
		//创建右侧标题数组  
		var rightTitle = [ [ "#", "书法绘画" ] , [ "#", "书法绘画" ], [ "#", "摄影摄像" ], ["","》"]];
		$.post("indexProduct", {
			page : "001",
			fromPosition : "0010501",
			toPosition : "0010510",
			newsToPosition : "0010509"
		}, function(data, status) {
			var product = data.pictureAndProduct;
			//拼接商品区域的html
			var goods_html = combineGoodsOne("工艺美术", rightTitle, product, "论坛/", data.news);
			$("#index_gongyi").html(goods_html);
			
			//拼接广告区域
			var ad_html = combineBottomAdTwo(product[9]);
			$("#index_gongyi_ad").html(ad_html);
			
		}, "json");
		
		index_floor_state[1] = true;
	}else if(scrollLength > 2600 && scrollLength < 3200 && !index_floor_state[2]){
		//创建右侧标题数组  
		var rightTitle = [ [ "#", "书法绘画" ] , [ "#", "书法绘画" ], [ "#", "摄影摄像" ], ["",">>"]];
		$.post("indexProduct", {
			page : "001",
			fromPosition : "0010601",
			toPosition : "0010610",
			newsToPosition : "0010609"
		}, function(data, status) {
			var product = data.pictureAndProduct;
			//拼接商品区域的html
			var goods_html = combineGoodsOne("影视娱乐", rightTitle, product, "论坛/", data.news);
			$("#index_yingshi").html(goods_html);
			
			var ad_html = combineBottomAdTwo(product[9]);
			$("#index_yingshi_ad").html(ad_html);
			
		}, "json");
		index_floor_state[2] = true;
	}else if(scrollLength > 3200 && scrollLength < 3800 && !index_floor_state[3]){
		//创建右侧标题数组  
		var rightTitle = [ [ "#", "书法绘画" ] , [ "#", "书法绘画" ], [ "#", "摄影摄像" ], ["",">>"]];
		$.post("indexProduct", {
			page : "001",
			fromPosition : "0010701",
			toPosition : "0010712",
			newsToPosition : "0010709"
		}, function(data, status) {
			var product = data.pictureAndProduct;
			//拼接商品区域的html
			var goods_html = combineGoodsOne("戏剧舞蹈", rightTitle, product, "论坛/", data.news);
			$("#index_xiju").html(goods_html);
			
			//拼接广告区域
			var ad_html = combineBottomAdOne(product[9], product[10], product[11]);
			$("#index_xiju_ad").html(ad_html);
			
		}, "json");
		
		index_floor_state[3] = true;
	}else if(scrollLength > 3800 && scrollLength < 4400 && !index_floor_state[4]){
		//创建右侧标题数组  
		var rightTitle = [ [ "#", "书法绘画" ] , [ "#", "书法绘画" ], [ "#", "摄影摄像" ], ["",">>"]];
		$.post("indexProduct", {
			page : "001",
			fromPosition : "0010801",
			toPosition : "0010810",
			newsToPosition : "0010809"
		}, function(data, status) {
			var product = data.pictureAndProduct;
			//拼接商品区域的html
			var goods_html = combineGoodsOne("动漫游戏", rightTitle, product, "论坛/", data.news);
			$("#index_dongman").html(goods_html);
			
			//拼接广告区域
			var ad_html = combineBottomAdTwo(product[9]);
			$("#index_dongman_ad").html(ad_html);
			
		}, "json");
		
		index_floor_state[4] = true;
	}else if(scrollLength > 4400 && scrollLength < 5000 && !index_floor_state[5]){
		//创建右侧标题数组  
		var rightTitle = [ [ "#", "书法绘画" ] , [ "#", "书法绘画" ], [ "#", "摄影摄像" ], ["",">>"]];
		$.post("indexProduct", {
			page : "001",
			fromPosition : "0010901",
			toPosition : "0010912",
			newsToPosition : "0010909"
		}, function(data, status) {
			var product = data.pictureAndProduct;
			//拼接商品区域的html
			var goods_html = combineGoodsOne("音像制品", rightTitle, product, "论坛/", data.news);
			$("#index_yinxiang").html(goods_html);
			
			//拼接广告区域
			var ad_html = combineBottomAdOne(product[9], product[10] ,  product[11]);
			$("#index_yinxiang_ad").html(ad_html);
			
		}, "json");
		
		index_floor_state[5] = true;
	}else if(scrollLength > 5000 && scrollLength < 5600 && !index_floor_state[6]){
		//创建右侧标题数组  
		var rightTitle = [ [ "#", "书法绘画" ] , [ "#", "书法绘画" ], [ "#", "摄影摄像" ], ["",">>"]];
		$.post("indexProduct", {
			page : "001",
			fromPosition : "0011001",
			toPosition : "0011010",
			newsToPosition : "0011009"
		}, function(data, status) {
			var product = data.pictureAndProduct;
			//拼接商品区域的html
			var goods_html = combineGoodsOne("图书报刊", rightTitle, product, "论坛/", data.news);
			$("#index_tushu").html(goods_html);
			
			//拼接广告区域
			var ad_html = combineBottomAdTwo(product[9]);
			$("#index_tushu_ad").html(ad_html);
			
		}, "json");
		
		index_floor_state[6] = true;
	}else if(scrollLength > 5600 && scrollLength < 6200 && !index_floor_state[7]){
		//创建右侧标题数组  
		var rightTitle = [ [ "#", "书法绘画" ] , [ "#", "书法绘画" ], [ "#", "摄影摄像" ], ["",">>"]];
		$.post("indexProduct", {
			page : "001",
			fromPosition : "0011101",
			toPosition : "0011112",
			newsToPosition : "0011109"
		}, function(data, status) {
			
			var product = data.pictureAndProduct;
			
			//拼接商品区域的html
			var goods_html = combineGoodsOne("文化会展", rightTitle, product, "论坛/", data.news);
			$("#index_huizhan").html(goods_html);
			
			//拼接广告区域
			var ad_html = combineBottomAdOne(product[9],product[10],product[11]);
			$("#index_huizhan_ad").html(ad_html);
			
		}, "json");
		
		index_floor_state[7] = true;
	}else if(scrollLength > 6200 && scrollLength < 6800 && !index_floor_state[8]){
		//创建右侧标题数组  
		var rightTitle = [ [ "#", "书法绘画" ] , [ "#", "书法绘画" ], [ "#", "摄影摄像" ], ["",">>"]];
		$.post("indexProduct", {
			page : "001",
			fromPosition : "0011201",
			toPosition : "0011210",
			newsToPosition : "0011209"
		}, function(data, status) {
			var product = data.pictureAndProduct;
			//拼接商品区域的html
			var goods_html = combineGoodsOne("创意设计", rightTitle, product, "论坛/", data.news);
			$("#index_sheji").html(goods_html);
			
			//拼接广告区域
			var ad_html = combineBottomAdTwo(product[9]);
			$("#index_sheji_ad").html(ad_html);
			
		}, "json");
		
		index_floor_state[8] = true;
	}else if(scrollLength > 6800 && scrollLength < 7400 && !index_floor_state[9]){
		//创建右侧标题数组  
		var rightTitle = [ [ "#", "书法绘画" ] , [ "#", "书法绘画" ], [ "#", "摄影摄像" ], ["",">>"]];
		$.post("indexProduct", {
			page : "001",
			fromPosition : "0011301",
			toPosition : "0011312",
			newsToPosition : "0011309"
		}, function(data, status) {
			var product = data.pictureAndProduct;
			//拼接商品区域的html
			var goods_html = combineGoodsOne("科研教育", rightTitle, product, "论坛/", data.news);
			$("#index_keyan").html(goods_html);
			
			//拼接广告区域
			var ad_html = combineBottomAdOne(product[9],product[10],product[11]);
			$("#index_keyan_ad").html(ad_html);
			
		}, "json");
		
		index_floor_state[9] = true;
	}else if(scrollLength > 7400 && scrollLength < 8000 && !index_floor_state[10]){
		//创建右侧标题数组  
		var rightTitle = [ [ "#", "书法绘画" ] , [ "#", "书法绘画" ], [ "#", "摄影摄像" ], ["",">>"]];
		$.post("indexProduct", {
			page : "001",
			fromPosition : "0011401",
			toPosition : "0011410",
			newsToPosition : "0011409"
		}, function(data, status) {
			var product = data.pictureAndProduct;
			//拼接商品区域的html
			var goods_html = combineGoodsOne("功夫体育", rightTitle, product, "论坛/", data.news);
			$("#index_gongfu").html(goods_html);
			
			var ad_html = combineBottomAdTwo(product[9]);
			$("#index_gongfu_ad").html(ad_html);
			
		}, "json");
		
		index_floor_state[10] = true;
	}else if(scrollLength > 8000 && scrollLength < 8600 && !index_floor_state[11]){
		//创建右侧标题数组  
		var rightTitle = [ [ "#", "书法绘画" ] , [ "#", "书法绘画" ], [ "#", "摄影摄像" ], ["",">>"]];
		$.post("indexProduct", {
			page : "001",
			fromPosition : "0011501",
			toPosition : "0011512",
			newsToPosition : "0011509"
		}, function(data, status) {
			var product = data.pictureAndProduct;
			//拼接商品区域的html
			var goods_html = combineGoodsOne("文化用品", rightTitle, product, "论坛/", data.news);
			$("#index_yongpin").html(goods_html);
			
			//拼接广告区域
			var ad_html = combineBottomAdOne(product[9],product[10],product[11]);
			$("#index_yongpin_ad").html(ad_html);
			
		}, "json");
		
		index_floor_state[11] = true;
	}else if (scrollLength > 8600 && scrollLength < 9200 && !index_floor_state[12]) {
		//创建右侧标题数组
		var rightTitle = [ [ "#", "书画摄影" ], [ "#", "篆刻雕塑" ], [ "#", "摄影摄像" ], ["","》"]];
		$.post("indexProduct", {
			page : "001",
			fromPosition : "0011601",
			toPosition : "0011612",
			newsToPosition : "0011609"
		}, function(data, status) {
			var product = data.pictureAndProduct;
			//拼接商品区域的html
			var goods_html = combineGoodsOne("休闲旅游", rightTitle, product, "论坛/", data.news);
			$("#index_xiuxian").html(goods_html);
			
			//拼接广告区域
			var ad_html = combineBottomAdOne(product[9], product[10], product[11]);
			$("#index_xiuxian_ad").html(ad_html);
			
		}, "json");
		
		index_floor_state[12] = true;
	}else if (scrollLength > 9200 && scrollLength < 9800 && !index_floor_state[13]) {
		//创建右侧标题数组
		var rightTitle = [ [ "#", "书画摄影" ], [ "#", "篆刻雕塑" ], [ "#", "摄影摄像" ], ["","》"]];
		$.post("indexProduct", {
			page : "001",
			fromPosition : "0011701",
			toPosition : "0011709",
			newsToPosition : "0011709"
		}, function(data, status) {
			var product = data.pictureAndProduct;
			//拼接商品区域的html
			var goods_html = combineGoodsOne("文化产业", rightTitle, product, "论坛/", data.news);
			$("#index_chanye").html(goods_html);
			
		}, "json");
		
		index_floor_state[13] = true;
	}else if (scrollLength > 9800 && scrollLength < 10400 && !index_floor_state[14]) {
		//创建右侧标题数组
		var rightTitle = [ [ "#", "书画摄影" ], [ "#", "篆刻雕塑" ], [ "#", "摄影摄像" ], ["","》"]];
		$.post("indexProduct", {
			page : "001",
			fromPosition : "0011801",
			toPosition : "0011809",
			newsToPosition : "0011809"
		}, function(data, status) {
			var product = data.pictureAndProduct;
			//拼接商品区域的html
			var goods_html = combineGoodsOne("公益直达", rightTitle, product, "论坛/", data.news);
			$("#index_zhida").html(goods_html);
			
		}, "json");
		
		index_floor_state[14] = true;
	}
}